package com.jishuo.nontax.web.bill;

import com.jishuo.base.annotation.UserAuthority;
import com.jishuo.base.bean.BaseResult;
import com.jishuo.base.bean.GridResult;
import com.jishuo.base.bean.Pagination;
import com.jishuo.nontax.bean.vo.PunishInfoVO;
import com.jishuo.nontax.bfc.service.PunishService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 通用罚没
 *
 * @auther dinggaofei
 * @Date 2023/3/15 15:06
 */
@Slf4j
@Controller
@RequestMapping(value = "/bill/punish", name = "通用罚没单据")
@UserAuthority(menu = {"bill/punish/punish","sys/baseDate/basedata"})
public class punishController {
    @Resource
    private PunishService punishService;

     private String prefix = "bill/";

    @RequestMapping(value = {"punish", "punish/{page}"}, name = "通用罚没首页")
    public String index(@PathVariable(required = false) String page) {
        return prefix + ((page == null) ? "punish" : page);
    }

    @ResponseBody
    @RequestMapping(value = "findPunishPage",name = "通用罚没单据列表")
    public GridResult<PunishInfoVO> findPunishPage(PunishInfoVO punishInfoVO, Pagination pagination){

        return  new GridResult<>(punishService.findPunishPage(punishInfoVO,pagination));
    }

    @ResponseBody
    @RequestMapping(value = "getPunish" ,name = "获取通用罚没单据")
    public  BaseResult  getPunish(Long  punishinfoid){
        return  punishService.getPunish(punishinfoid);
    }

    @ResponseBody
    @RequestMapping(value = "sendPunish",name = "发送通用罚没单据")
    public BaseResult sendPunish(@RequestParam List<String> billids, String userpwd, String usercode){
        return  punishService.sendPunish(billids,userpwd,usercode);
    }

    @ResponseBody
    @RequestMapping(value = "cleanPunish",name = "冲销通用罚没单据")
    public BaseResult cleanPunish(@RequestParam List<String> billids,String userpwd,String usercode){
        return  punishService.cleanPunish(billids,userpwd,usercode);
    }

    @ResponseBody
    @RequestMapping(value = "punishExport",name = "导出通用罚没单据")
    public void  punishExport(@RequestParam List<String> billids,String accountcode, HttpServletResponse response){
           punishService.punishExport(billids,accountcode, response);

    }
}
